package com.framework.sec.util;



import java.util.ArrayList;
import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

public class AuthenticatedUserDetailsService implements UserDetailsService {


	@Override
	public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
      User user = null;

      try   {
//		 user = offeringService.getUser(username);
      }
      catch(Exception e) {
         user = null;
      }
		
		List<GrantedAuthority> grantedAuthorityList = new ArrayList<GrantedAuthority>();
		if(user != null) {
//         if (StringUtils.hasText(user.getUserAccess()) ) {
//            grantedAuthorityList.add(new GrantedAuthorityImpl(user.getUserAccess()));
//         }
      }
		return new org.springframework.security.core.userdetails.User(username, 
																		"", 
																		true, 
																		true, 
																		true, 
																		true, 
																		grantedAuthorityList);


	}
	
}
